{% extends "layout/content.twig" %}

{% block main %}
    <div class="layui-card">
        <div class="layui-card-header">模型数据mock</div>
        <div class="layui-card-body">
            <div class="layui-row mt10">
                <div class="layui-col-md5">
                    <form class="layui-form" action="">

                        {% include "develop/table.twig" %}

                        <div class="layui-form-item">
                            <label class="layui-form-label">生成数量</label>
                            <div class="layui-input-block">
                                <input type="text"
                                       name="limit"
                                       class="layui-input layui-input"
                                       placeholder="请输入数量"
                                       autocomplete="off"
                                       value="10"
                                >
                                <div class="layui-form-mid layui-word-aux">单次最大值100</div>
                            </div>
                        </div>
                        <div class="layui-form-item">
                            <div class="layui-input-block">
                                <button class="layui-btn layui-btn-normal" lay-submit lay-filter="formSubmit">确定
                                </button>
                            </div>
                        </div>
                    </form>
                </div>
            </div>
        </div>
    </div>
{% endblock %}

{% block script %}
    <script type="text/javascript">
      layui.extend({
        page: '{/}{{ static('js/page') }}',
        http: '{/}{{ static('js/http') }}'
      })
      layui.use(['code', 'http', 'form', 'toast'], function () {
        let http = layui.http
        let form = layui.form
        let toast = layui.toast
        form.on('submit(formSubmit)', function (data) {
          if (!data.field.table) {
            return toast.center('请选择一张表')
          }
          http.form('{{ auth_route('develop/mock') }}', data.field)
          return false
        })
      })
    </script>
{% endblock %}